<template>
	<view class="content">
		<template v-if="type==1">

			<view class="info-item" v-for="(item,index) in schoolList" :key="item.id" @click="navigate('/page_other/union/school-detail?id='+item.id)">
				<view class="left-item">
					<image :src="item.logo" class="img"></image>
					<view class="title">{{item.schoolName}}</view>
				</view>
				<view class="iconfont icon-gengduo1"></view>
			</view>
		</template>
		<template v-if="type==2">
			<view style="text-align: center;">暂无数据</view>
		</template>
	</view>
</template>

<script>
	import {
		getSchoolList
	} from '@/api/union_school.js'
	export default {
		data() {
			return {
				imageUrl: '',
				type: null,
				page: 1,
				limit: 6,
				schoolList: [],
				count: 0
			}
		},
		methods: {
			navigate(url) {
				uni.navigateTo({
					url
				})
			},
			getSchoolListDetail() {
				getSchoolList({
					page: this.page,
					limit: this.limit,
				}).then((res) => {
					this.schoolList = res.list
					this.count = res.count
					console.log(this.schoolList)
				})
			},
		},
		onLoad(e) {
			this.imageUrl = this.globalConfig.imageUrl
			uni.setNavigationBarTitle({
				title: e.name
			})
			this.type = e.type
			this.getSchoolListDetail()
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100%;
		padding: 30rpx;

		.info-item {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 30rpx;
			padding: 30rpx;
			height: 180rpx;
			background: #fff;
			box-shadow: 0 0 10px 0 #efefef;
			border-radius: 20rpx;


			.left-item {
				display: flex;
				align-items: center;

				.img {
					width: 100rpx;
					height: 100rpx;
					border-radius: 10rpx;
					margin-right: 20rpx;
				}

				.title {
					font-weight: bold;
				}
			}

			.iconfont {
				font-size: 32rpx;
				color: #999;
			}
		}
	}
</style>